function [S_min,fval] = GaOpt(r,T,T_range,lb,ub,contype)
% GA 遗传算法
if T_range
    fun = @(S)AvgGdop(T_range,S);
else
    fun = @(S)SingleGdop(T,S);
end
nonlcon = @(S)mycon(T,S,contype,r);
A = [];
b = [];
Aeq = [];
beq = [];
[S_min,fval] = ga(fun,6,A,b,Aeq,beq,lb,ub,nonlcon);
end

